#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#define fill(a, c) memset(a, c, sizeof(a))
#define ldb long double
#define LL long long
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define sqr(a) ((a) * (a))
#define debug(a) cerr << #a << " = " << a << " ";
#define debugl(a) cerr << #a << " = " << a << "\n";
const ldb eps = 1e-9;
const ldb LDINF = 1e70;
const LL LINF = 1ll << 60;
const int INF = 1 << 30;
const ldb pi = fabs(atan2(0.0, -1.0));
using namespace std;

int n, k;
int a[100010];
int all[100010];
int sz;
int TSIZE;
int tr_key[2 * (1 << 17) + 1];
int ex[2 * (1 << 17) + 1];
int tr_cnt[2 * (1 << 17) + 1];

void Load()
{
	scanf("%d%d", &n, &k);
	int i;
	sz = 0;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
		all[sz++] = a[i];
   	}
}

inline void upd(int i)
{
	if (tr_key[(i << 1) | 1])
		ex[i] = ex[(i << 1) | 1];
	else ex[i] = ex[i << 1];
	if (tr_key[i << 1] > tr_key[(i << 1) | 1])
		{
			tr_key[i] = tr_key[i << 1];
			tr_cnt[i] = tr_cnt[i << 1];
		}
		else if (tr_key[i << 1] < tr_key[(i << 1) | 1])
		{
			tr_key[i] = tr_key[(i << 1) | 1];
			tr_cnt[i] = tr_cnt[(i << 1) | 1];
		}
		else 
		{
			tr_key[i] = tr_key[i << 1];
			tr_cnt[i] = tr_cnt[i << 1] + tr_cnt[(i << 1) | 1];
		}
}

inline int find(int key)
{
	int l = 0;
	int r = sz - 1;
	int mid;
	while (l <= r)
	{
    	mid = (l + r) / 2;
    	if (all[mid] == key)
    		return mid;
    	else if (all[mid] < key)
    		l = mid + 1;		
    	else r = mid - 1;

    }
    return -1;
}

inline int Next(int v, int x)
{
	while (true)
	{
		if (v >= TSIZE)
		{
			if (x <= v - TSIZE)
				return v - TSIZE;
			return -1;
    	}
		if (tr_key[v << 1] > 0 && ex[v << 1] >= x)
		{
			v <<= 1;
			continue;
		}
		else if (tr_key[(v << 1) | 1] > 0 && ex[(v << 1) | 1] >= x)
		{
			v <<= 1;
			v |= 1;
			continue;
		}
		else return -1;
	}
}

inline int Next(int v, int x, int mx)
{
	if (v >= TSIZE)
	{
		if (tr_key[v] == mx && x <= v - TSIZE)
			return v - TSIZE;
		return -1;
   	}
   	int t = -1;
	if (tr_key[v << 1] == mx && ex[v << 1] >= x)
	{
		t = Next(v << 1, x, mx);
	}
	if (t != -1) return t;
	if (tr_key[(v << 1) | 1] == mx && ex[(v << 1) | 1] >= x)
	{
		t = Next((v << 1) | 1, x, mx);
	}
	return t;
}

inline void Update(int i)
{
	while (i > 0)
	{
		upd(i);
		i >>= 1;
	}
}

inline void Add(int j)
{
 	tr_key[TSIZE + j]++;
 	Update((TSIZE + j) / 2);
}

inline void Delete(int j)
{
 	tr_key[TSIZE + j]--;
 	Update((TSIZE + j) / 2);
}

inline int GetMax(int l, int r, int &cnt)
{
	int res = 0;
	cnt = 0;
	while (l <= r)
	{
		if (l % 2 == 1)		
		{
			if (tr_key[l] > res)
			{
				res = tr_key[l];
				cnt = tr_cnt[l];
			}
			else if (tr_key[l] == res)
			{
				cnt += tr_cnt[l];
			}
			l++;
		}
		if (r % 2 == 0)		
		{
			if (tr_key[r] > res)
			{
				res = tr_key[r];
				cnt = tr_cnt[r];
			}
			else if (tr_key[r] == res)
			{
				cnt += tr_cnt[r];
			}
			r--;
		}
		l >>= 1;
		r >>= 1;
	}
	return res;
}

void Solve()
{
	sort(a, a + n);
	sort(all, all + sz);
	{
		int i = 1;
		for (int j = 1; j < sz; j++)
		{
			if (all[j] != all[i - 1])
			{
				all[i++] = all[j];
			}
		}
		sz = i;
	}
	TSIZE = 1;
	while (TSIZE < sz) TSIZE <<= 1;
	int i;
	for (i = 0; i < sz; i++)
	{
			tr_key[TSIZE + i] = 0;
			tr_cnt[TSIZE + i] = 0;
			ex[TSIZE + i] = 0;
	}
	int t;
	for (i = 0; i < n; i++)
	{
		t = find(a[i]);
		tr_key[TSIZE + t]++;
		tr_cnt[TSIZE + t] = 1;
		ex[TSIZE + t] = t;
	}
	for (i = n; i < TSIZE; i++)
		tr_key[TSIZE + i] = tr_cnt[TSIZE + i] = 0;
	for (i = TSIZE - 1; i >= 1; i--)
	{
		upd(i);
	}
	if (tr_key[1] > n / k)
	{
		printf("-1\n");
		return;
	}

	int j, l;
	int cnt;
	int lst;
	for (l = -1, i = 0; i < n; i++)
	{
		if (i % k == 0)
		{
			l++;
			j = Next(1, 0);
		}
		else 
		{
			j = Next(1, lst + 1);
		}
		for (; j != -1; j = Next(1, j + 1, t))
		{
			Delete(j);
			t = GetMax(TSIZE, TSIZE + sz - 1, cnt);
			if (t <= n / k - l - 1 || t == n / k - l && cnt <= k - (i % k) - 1)
			{
				printf("%d ", all[j]);
				lst = j;
				break;
			}
			Add(j);
		}
		if (j == -1)
		{
			printf("-1\n");
			return;
		}
	}
	printf("\n");
}

int main()
{
	
	int t;
	scanf("%d", &t);
	int i;
	for (i = 0; i < t; i++)
	{
		Load();
//		cerr << "Do " << i + 1 << "\n";
		Solve();
	}
	return 0;
}
